<template>
    <div class="index">
        <div class="indexTop">
            <input type="text" placeholder="输入商家,商品名称">
        </div>
        <div class="indexBanner">
            <img src="../../assets/7.jpg" alt="" class="img1">
        </div>
        <div class="indexMain">
            <div class="title">猜你喜欢</div>
            <div class="once">
                <span class="onceli">综合排序</span>
                <span class="onceli">距离最近</span>
                <span class="onceli">销量最高</span>
                <span class="onceli">筛选</span>
            </div>
            <div class="twonce">
                <span class="twonceli">年货节热卖</span>
                <span class="twonceli">津贴联盟</span>
                <span class="twonceli">满减优惠</span>
                <span class="twonceli">品质联盟</span>
            </div>
            <div class="three">
                <div class="list" v-for="(item,index) in indexlist" :key="index" >
                    <div class="left">
                        <img :src="item.picUrl" alt="" class="img2">
                    </div>
                    <div class="right">
                        <div class="first">{{item.name}}</div>
                        <div class="second">{{item.monthSalesTip}}</div>
                        <div class="third">{{item.minPriceTip}}</div>
                        <div class="force">{{item.shippingFeeTip}}</div>
                    </div>
                    <div class="box">
                        <span class="time">{{item.deliveryTimeTip}}</span>
                        <span class="gongli">{{item.distance}}</span>
                    </div>
                </div>
            </div>
        </div>
    </div>

    
    
</template>

<script>

import { user_shouye } from '../../api'

export default {
    data(){
        return{
            indexlist:[]
        }
    },
    mounted(){
        user_shouye().then((res)=>{
            this.indexlist = res.data.list
        })
    }
}
</script>

<style>
    .indexTop{
        display: flex;
        justify-content: center;
        align-items:center ;
        width: 100%;
        height: 80px;
        background-color: rgb(7, 118, 198);
        border-radius:20px;
    }
    input{
        width: 80%;
        height: 50px;
        text-align: center;
        border: none;
        border-radius:20px;
        font-size: 20px;
    }
    .indexBanner{
        width: 100%;
        margin-top:5px ;
    }
    .img1{
        width: 100%;
        height: 130px;
        border-radius: 20px;
    }
    .indexMain{
        margin-top: 5px;
    }
    .title{
        font-size: 22px;
        font-weight: 700;
    }
    .once{
        font-size: 18px;
        display: flex;
        height: 40px;
        justify-content: space-between;
    }
    .onceli{
        width: 22%;
        height: 40px;
        text-align: center;
        line-height: 40px;
    }
    .twonce{
        display: flex;
        height: 40px;
        justify-content: space-between;
    }
    .twonceli{
        width: 24%;
        height: 40px;
        text-align: center;
        line-height: 40px;
        background-color: #eee;
        border-radius: 10px;
    }

    .three{
        width: 100%;
        height: 330px;
        overflow: auto;
    }
    .list{
        display: flex;
        box-sizing: border-box;
        padding: 5px;
        position: relative;
        margin-bottom: 10px;
    }
    .left{
        width: 30%;
        background-color: white;
        
    }
    .img2{
        width: 100%;
        height: 100px;
        border-radius: 10px;
    }
    .right{
        margin-top: 5px;
        margin-left: 10px;
    }
    .first{
        font-size: 16px;
        font-weight: 700;
        margin-bottom: 5px;
    }
    .second{
        font-size: 12px;
        color: rgb(78, 76, 76);
        margin-bottom: 5px;
    }
    .third{
        color: red;
        font-size: 14px;
        margin-bottom: 5px;
    }
    .fourth{
        display: flex;
        align-items: center;
        font-size: 14px;
    }
    .box{
        position: absolute;
        right:10px;
        top:60px
    }
    .time{
        margin-left: 5px;
        color: #aaa;
    }
    .gongli{
        margin-left: 13px;
        color: #aaa;
    }
</style>